package com.yida.gwj.api.factory;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.yida.common.core.domain.R;
import com.yida.gwj.api.domain.GwjMaintenanceFundsBusinessInner;
import com.yida.gwj.api.service.RemoteGwjExpendInnerService;
import com.yida.gwj.api.service.RemoteGwjExpendService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 公维金服务降级处理
 *
 * @author hmh
 */
@Component
public class RemoteGwjExpendInnerFallbackFactory implements FallbackFactory<RemoteGwjExpendInnerService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteGwjExpendInnerFallbackFactory.class);

    @Override
    public RemoteGwjExpendInnerService create(Throwable throwable) {
        log.error("公维金外网支出服务调用失败:{}", throwable.getMessage());
        return new RemoteGwjExpendInnerService() {
            @Override
            public R<GwjMaintenanceFundsBusinessInner> getMaintenanceFundsBusinessInfoByBizId(Long bizId, String source) {
                return R.fail("公维金公共维修资金业务信息查询失败:{}" + throwable.getMessage());
            }

        };
    }

}
